package com.moshang.blog.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 
 * 
 * @author moshang
 * @email 597575122@qq.com
 * @date 2018-09-21 14:45:09
 */
@TableName("sys_menu")
@Data
@ToString
@EqualsAndHashCode
public class SysMenu extends BaseEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 
	 */
	@TableId(type = IdType.AUTO)
	private Integer id;
	/**
	 * 资源名称
	 */
	private String name;
	/**
	 * 父id
	 */
	private Integer parentId;
	/**
	 * 层级
	 */
	private Integer level;
	/**
	 * 父菜单连集
	 */
	private String parentIds;
	/**
	 * 排序
	 */
	private Integer sort;
	/**
	 *链接地址
	 */
	private String href;
	/**
	 *打开方式
	 */
	private String target;
	/**
	 *菜单图标
	 */
	private String icon;
	/**
	 *显示背景色
	 */
	private String bgColor;
	/**
	 * 是否显示
	 */
	@TableField(value="is_show",strategy= FieldStrategy.IGNORED)
	private Boolean isShow;
	/**
	 *权限
	 */
	private String permission;
	private String remarks;
	@TableField(exist = false)
	private Integer dataCount;
	@TableField(exist = false)
	private List<SysRole> roleList;
	@TableField(exist = false)
	private List<SysMenu> children=new ArrayList<SysMenu>();

	public void addChild(SysMenu sysMenu){
		children.add(sysMenu);
	}
}
